//左下饼图
var pieLeftBottom1=[
	{value:40292871, name:'IDC',labelLine:{show:true}},
    {value:4523217, name:'CDN'},
    {value:1786256, name:'云计算'},
    {value:675268, name:'专线'}
]
var pieLeftBottom2=[
	{value:33978422, name:'IDC',labelLine:{show:true}},
	{value:2701523, name:'云计算'},
	{value:657136, name:'CDN'},
	{value:606605, name:'专线'}
]
var pieLeftBottom3=[
		{
		    value: 3482,
		    name: 'IDC',
		    labelLine:{show:true}
		}, {
            value: 2657,
            name: 'CDN'
        }, {
            value: 766,
            name: '云计算'
        }, {
            value: 437,
            name: '专线'
        }]
//var databeauty = [121, 388, 233, 309]
var pieOptionLeftBottom = {
		textStyle:{},
    title: {
        text: "",
        subtext: "",
        left: "center",
        textStyle: {
            color: "#fff",
            fontSize: 18
        },
    },
		color:['#2191d8','#8421d8','#d88821','#88ff4e'],
		legend: {
			show:true,
//      orient: 'vertical',
//      x: 'left',
				bottom:10,
        textStyle: {
            color: "#fff",
//          fontSize: 18
        },
        data:['IDC','云计算','专线','CDN']
    },
    tooltip: {
        trigger: 'item',
        confine: true,
        textStyle:{},
        formatter: "{a} <br/>{b}:{c}({d}%)"
    },
    series: [{
        name: 'IP资源',
        type: 'pie',
        selectedMode: 'single',
        radius: [0, '13%'],
        center: ['50%','47%'],
        z:3,
        label: {
        	color:'#fff',
        	formatter:function(parmas){
        		if(parmas.data.name=='IDC'){
        			return 'IP资源'
        		}else{
        			return ''
        		}
        	},
        	emphasis:{
        		show:false
        	}
        },
        labelLine: {
          show:false,
          length:50,
          length2:50,
          lineStyle:{
          	color:"#fff"
          },
          emphasis:{
          	lineStyle:{
//        		show:true,
	          	color:"#fff"
	          }
          }
        },
        data: pieLeftBottom1
    }, {
        name: '顶级域名',
        type: 'pie',
        radius: ['20%', '43%'],
        z:2,
        center: ['50%','47%'],
        labelLine: {
          show:false,
          length:40,
          lineStyle:{
          	color:"#fff"
          },
          emphasis:{
//        	show:true,
          	lineStyle:{
	          	color:"#fff"
	          }
          }
        },
        label: {
        	show:true,
        	color:'#fff',
        	formatter:function(parmas){
        		if(parmas.data.name=='IDC'){
        			return '顶级域名'
        		}else{
        			return ''
        		}
        	}
        },
        data:pieLeftBottom2
    }, {
        name: '机房',
        type: 'pie',
        radius: ['51%', '75%'],
        center: ['50%','47%'],
        z:1,
        label: {
        	color:'#fff',
        	formatter:function(parmas){
//      		console.log(parmas,'----123455-')
        		if(parmas.data.name=='IDC'){
        			return '机房'
        		}else{
        			return ''
        		}
        	}
        },
        labelLine:{
        	show:false,
        	lineStyle:{
          	color:"#fff"
          },
          emphasis:{
//        	show:true,
          	lineStyle:{
	          	color:"#fff"
	          }
          }
        },
        data: pieLeftBottom3
    }]
};
var myBarChart = echarts.init(document.getElementById('myBarList'))
myBarChart.setOption(optionFontSize(pieOptionLeftBottom))
//lineChart.setOption(optionFontSize(lineOption))


//地图
var mapSkinColor=localStorage.webSkin?JSON.parse(localStorage.webSkin).skinMap:['#0f2d87','#3770ea','#2a56bd']
console.log(mapSkinColor)

var geoCoordMap = {};
var mapData=[
    {name:'上海',value:0,comp:190,room:266,ip:1966831,domain:18793944},
		{name:'云南',value:0,comp:19 ,room:57 ,ip:1607248,domain:74945   },
		{name:'内蒙古',value:0,comp:17 ,room:60 ,ip:9408   ,domain:84010  },
		{name:'北京',value:0,comp:536,room:680,ip:5221468,domain:15873681},
		{name:'吉林',value:0,comp:37 ,room:69 ,ip:98507  ,domain:90997   },
		{name:'四川',value:0,comp:69 ,room:128,ip:1689271,domain:2806582 },
		{name:'天津',value:0,comp:132,room:162,ip:1218036,domain:959816  },
		{name:'宁夏',value:0,comp:16 ,room:26 ,ip:114681 ,domain:182862  },
		{name:'安徽',value:0,comp:31 ,room:77 ,ip:782640 ,domain:1190842 },
		{name:'山东',value:0,comp:83 ,room:116,ip:6590096,domain:7089482 },
		{name:'山西',value:0,comp:37 ,room:90 ,ip:181939 ,domain:104134  },
		{name:'广东',value:0,comp:325,room:483,ip:4597909,domain:12530461},
		{name:'广西',value:0,comp:21 ,room:44 ,ip:1725308,domain:1543051 },
		{name:'新疆',value:0,comp:14 ,room:43 ,ip:185745 ,domain:155578  },
		{name:'江苏',value:0,comp:94 ,room:189,ip:1420019,domain:7639244 },
		{name:'江西',value:0,comp:29 ,room:70 ,ip:6221153,domain:2078774 },
		{name:'河北',value:0,comp:82 ,room:136,ip:2784100,domain:1111634 },
		{name:'河南',value:0,comp:42 ,room:55 ,ip:767721 ,domain:2154536 },
		{name:'浙江',value:0,comp:159,room:252,ip:1686328,domain:4760153 },
		{name:'海南',value:0,comp:13 ,room:21 ,ip:223189 ,domain:50498   },
		{name:'湖北',value:0,comp:83 ,room:136,ip:2260443,domain:4172605 },
		{name:'湖南',value:0,comp:55 ,room:109,ip:2665234,domain:4582440 },
		{name:'甘肃',value:0,comp:10 ,room:14 ,ip:309585 ,domain:34320   },
		{name:'福建',value:0,comp:86 ,room:158,ip:4357215,domain:1641189 },
		{name:'西藏',value:0,comp:5  ,room:7  ,ip:10978  ,domain:25739   },
		{name:'贵州',value:0,comp:25 ,room:61 ,ip:111445 ,domain:43362   },
		{name:'辽宁',value:0,comp:69 ,room:114,ip:208081 ,domain:1753662 },
		{name:'重庆',value:0,comp:32 ,room:39 ,ip:2347631,domain:213934  },
		{name:'陕西',value:0,comp:32 ,room:48 ,ip:324182 ,domain:1490821 },
		{name:'青海',value:0,comp:5  ,room:9  ,ip:298305 ,domain:19304   },
		{name:'黑龙江',value:0,comp:34 ,room:78 ,ip:229652 ,domain:655661 },
//		{name:'台湾',value:0,comp:0 ,room:0 ,ip:0 ,domain:0},
//		{name:'香港',value:0,comp:0 ,room:0,ip:0 ,domain:0},
//		{name:'澳门',value:0,comp:0 ,room:0,ip:0 ,domain:0}
]
var convertData = function (data) {
//	console.log(data)
  var res = [];
  for (var i = 0; i < data.length; i++) {
      var geoCoord = geoCoordMap[data[i].name];
      if (geoCoord) {
          res.push({
              name: data[i].name,
              value: geoCoord.concat(data[i].value),
              comp: data[i].comp,
             	room: data[i].room,
             	ip: data[i].ip,
             	domain: data[i].domain,
             	rank: data[i].rank
          });
      }
  }
//console.log(res,'--22----')
  return res;
};
//重新渲染地图数据
function mapEvt(){
	var max1=mapData[0].comp
	var max2=mapData[0].room
	var max3=mapData[0].ip
	var max4=mapData[0].domain
	for(var i=0;i<mapData.length;i++){
		for(var j=0;j<mapData.length;j++){
			if( max1 <= mapData[j].comp ){    
				max1 = mapData[j].comp
			} 
			if( max2 <= mapData[j].room ){    
				max2 = mapData[j].room 
			}
			if( max3 <= mapData[j].ip ){    
				max3 = mapData[j].ip
			}
			if( max4 <= mapData[j].domain ){    
				max4 = mapData[j].domain
			}
		}
		mapData[i].value=(mapData[i].comp/max1+mapData[i].room/max2+mapData[i].ip/max3+mapData[i].domain/max4).toFixed(2)
	}
}
mapEvt(mapData)
function rank(data){
	var newData=data.sort(function(a,b){
		return b.value-a.value
	})
	for(var i=0;i<data.length;i++){
		newData[i].rank=i+1
	}
	return newData
}
rank(mapData)

var mapFeatures = echarts.getMap('china').geoJson.features;
mapFeatures.forEach(function(v) {
    // 地区名称
    var name = v.properties.name;
    // 地区经纬度
    geoCoordMap[name] = v.properties.cp;
});

var classString=['up','down'];

var optionMap = {
	textStyle: {
	},
	tooltip: {
		trigger: 'item',
		textStyle:{
//			fontSize
		},
		formatter:function(param){
//			console.log(param)
//				console.log(param)
			var province = param.name;
			if(province !='香港' && province !='澳门' && province !='台湾' ){
				return  '<div>'+param.name+'</div>' +
				        '<div>接入企业数：'+param.data.comp+'</div>'+
						'<div>机房数：'+param.data.room+'</div>'+
						'<div>ip数：'+param.data.ip+'</div>'+
						'<div>域名数：'+param.data.domain+'</div>';
			}
		}
	},
/*	visualMap: {
    seriesIndex: 0,
    min: 0,
    max: 3,
    show : false,
    left: '3%',
    itemHeight:'80',
    bottom:'10%',
    inRange: {
      //color: ['#42a5e1','#076ba6']
    	//color: ['rgb(136, 249, 244)','#076ba6']
	 //color: ['#3AE9F2','#FFBA3F'] 
		color: ['#3AE9F2','#FFBA3F']
    },
//      text: ['高','低'],           // 文本，默认为数值文本
    calculable: true,
    textStyle:{
    	color:'#fff'
    }
//  hoverLink: false
	},*/
	geo: {
		show: true,
		zoom: 1.2,
		roam: false,	
		map:'china',
		itemStyle: {
			normal: {
				show:false,
				borderColor: '#285ac6',
				borderWidth: 1,
				areaColor: '#123082',
				shadowBlur: 3,
				shadowColor:'#081435',
				shadowOffsetX: -4,
				shadowOffsetY: 8
			},
			emphasis: {
				areaColor: '#fce24f',
				borderColor: '#fce24f'
			}
		}
	},
	series: [{
		type: 'map',
		zoom: 1.2,
		mapType: 'china',
//		geoIndex: 0,
		roam: false,
		label: {
			normal: {
				show: false,
				textStyle: {
					color: '#fff'
				}
			},
			emphasis: {
				show: true,
				textStyle: {
					color: '#fff'
				}
			}
		},
		itemStyle: {
			normal: {
				show:false,
				borderColor: mapSkinColor[1],
				borderWidth: 1,
				areaColor: mapSkinColor[0]
			},
			emphasis: {
				areaColor: mapSkinColor[2],
				borderColor: mapSkinColor[2],
//				opacity: 0.8,
			}
		},
		data:convertData(mapData.sort(function (a, b) {
          return b.value - a.value;
      }))
	},{
		 	name: 'Top 5',
      type: 'effectScatter',
      zlevel: 1,
      coordinateSystem: 'geo',
      symbolSize: function (val) {
          return val[2]*4+8;
      },
      showEffectOn: 'render',
      rippleEffect: {
          brushType: 'stroke'
      },
      hoverAnimation: true,
      label: {
          normal: {
//            formatter: '{b}',
		        position: 'right',
		        show: false
          }
      },
      itemStyle: {
          normal: {
              color: '#f4e925',
              shadowBlur: 10,
              shadowColor: '#333'
          }
      },
//    data: convertData(mapData)
			data:convertData(mapData.sort(function (a, b) {
          return b.value - a.value;
      }).slice(0, 5))
	},{
		 	name: 'Top 5',
      type: 'scatter',
      zlevel: 1,
      coordinateSystem: 'geo',
      symbolSize: function (val) {
          return val[2]*4+8;
      },
      showEffectOn: 'render',
      rippleEffect: {
          brushType: 'stroke'
      },
      hoverAnimation: true,
      label: {
          normal: {
//            formatter: '{b}',
		        position: 'right',
		        show: false
          }
      },
      itemStyle: {
          normal: {
              color: '#f4e925',
              shadowBlur: 10,
              shadowColor: '#333'
          }
      },
//    data: convertData(mapData)
			data:convertData(mapData.sort(function (a, b) {
          return b.value - a.value;
      }).slice(5))
	}]
};
var mapChart = echarts.init(document.getElementById('ec_map_nd'))
mapChart.setOption(optionFontSize(optionMap))
//根据地图数据轮播

var count = 0;
var timer = null;
var dataLength = optionMap.series[0].data.length;
var cityShow=function() {
	$("#ranklistRight3 .tab_content").html("")
    var style = 'up';
	var rank = mapData[count% dataLength].rank;
    if(rank == 1){
    	style = 'up';
    }else{
    	style = classString[parseInt(Math.random()*10)%2];
    }
	$("#ranklistRight3 .tab_content").append("<tr>"+
    "<td>"+mapData[count% dataLength].name+"</td>"+
    "<td>"+(mapData[count% dataLength].value*2.5).toFixed(1)+"</td>"+
    "<td>"+mapData[count% dataLength].rank+"</td>"+
    "<td><div class="+style+ "></div></td>"+
	"</tr>")
    mapChart.dispatchAction({
        type: 'downplay',
        seriesIndex: 0,
    });
    mapChart.dispatchAction({
        type: 'highlight',
        seriesIndex: 0,
        dataIndex: (count) % dataLength
    });
    mapChart.dispatchAction({
        type: 'showTip',
        seriesIndex: 0,
        dataIndex: (count) % dataLength
    });
    count++;
}
cityShow()
timer = setInterval(cityShow, 2000);

mapChart.on('mouseover',function(params){
	clearInterval(timer);
//	keyRank(params);
	//console.log(params,'------');
	var style = 'up';
	var rank = params.data.rank;
    if(rank == 1){
    	style = 'up';
    }else{
    	style = classString[parseInt(Math.random()*10)%2];
    }
	$("#ranklistRight3 .tab_content").html("")
    $("#ranklistRight3 .tab_content").append("<tr>"+
    "<td>"+params.data.name+"</td>"+
    "<td>"+(params.data.value[2]*2.5).toFixed(1)+"</td>"+
    "<td>"+params.data.rank+"</td>"+
    "<td><div class="+style + "></div></td>"+
	"</tr>")
})
mapChart.on('mouseout',function(param){
//	console.log(param)
	clearInterval(timer)
	timer=setInterval(cityShow,2000)
})


function mapListEvt(name){
	$("#ranklistRight5 .tab_content").html("")
	for(var j=0;j<mapData.length;j++){
		if(mapData[j].name==name){
			 $("#ranklistRight5 .tab_content").append("<tr>"+
		                "<td>"+mapData[j].name+"</td>"+
		                "<td>"+mapData[j].comp+"</td>"+
		                "<td>"+mapData[j].room+"</td>"+
		                "<td>"+mapData[j].ip+"</td>"+
		                "<td>"+mapData[j].domain+"</td>"+
		            +"</tr>")
		}
	}
}

mapChart.on("mouseover", function (params){   
//	console.log(params.data.name)
	var name=params.data.name
    mapChart.dispatchAction({  
    	type: 'downplay', 
    	name: ['台湾','澳门','香港','']
    });    
});  

//地图点击跳转
mapChart.on('click',function(params){
	var name = params.name;
	if(name !='香港' && name !='澳门' && name !='台湾' && name !=''){
		myFrame.window.document.getElementById("mapNameOpen").value=params.name
		$(".map_open").show();
		$(".map_close").addClass('zoomIn animated')
		$(".map_open iframe").removeClass('zoomOut animated').addClass("zoomIn animated");
		var num = getRoomNum(name);
		myFrame.window.document.getElementById("topTip").innerHTML="<strong>"+params.name+"</strong>机房数<strong>"+num+"</strong>个"
	}
})
$(".map_close").click(function(){
	$(".map_open").fadeOut();
	$(".map_open iframe").removeClass('zoomIn animated').addClass("zoomOut animated");
})

$(".map_shadow").click(function(){
	$(".map_open").fadeOut();
	$(".map_open iframe").removeClass('zoomIn animated').addClass("zoomOut animated");
})

function getRoomNum(name){
	var num = 0;
	if(name == '上海'){
		num = 228;
	}else if(name == '云南'){
		num = 56;
	}else if(name == '内蒙古'){
		num = 58;
	}else if(name == '北京'){
		num = 585;
	}else if(name == '吉林'){
		num = 69;
	}else if(name == '四川'){
		num = 120;
	}else if(name == '天津'){
		num = 103;
	}else if(name == '宁夏'){
		num = 26;
	}else if(name == '安徽'){
		num = 79;
	}else if(name == '山东'){
		num = 110;
	}else if(name == '山西'){
		num = 87;
	}else if(name == '广东'){
		num = 439;
	}else if(name == '广西'){
		num = 44;
	}else if(name == '新疆'){
		num = 44;
	}else if(name == '江苏'){
		num = 246;
	}else if(name == '江西'){
		num = 69;
	}else if(name == '河北'){
		num = 127;
	}else if(name == '河南'){
		num = 51;
	}else if(name == '浙江'){
		num = 233;
	}else if(name == '海南'){
		num = 21;
	}else if(name == '湖北'){
		num = 132;
	}else if(name == '湖南'){
		num = 96;
	}else if(name == '甘肃'){
		num = 12;
	}else if(name == '福建'){
		num = 135;
	}else if(name == '西藏'){
		num = 7;
	}else if(name == '贵州'){
		num = 48;
	}else if(name == '辽宁'){
		num = 109;
	}else if(name == '重庆'){
		num = 37;
	}else if(name == '陕西'){
		num = 47;
	}else if(name == '青海'){
		num = 9;
	}else if(name == '黑龙江'){
		num = 76;
	}
	return num;
}

//右下饼图
var dataLeft=[{value:40292871, name:'IDC'},
              {value:4523217, name:'CDN'},
              {value:675268, name:'专线'},
              {value:1786256, name:'云计算'}]

var dataRight=[{value:33978422, name:'IDC'},
    			{value:657136, name:'CDN'},
    			{value:606605, name:'专线'},
    			{value:2701523, name:'云计算'}]

var dataPieTabMiddle=[{value:93, name:'基础企业'},
              {value:1696, name:'增值企业'}]

var dataPieTabRight=[{value:1261, name:'单一地区'},
              {value:528, name:'跨地区'}]


function legendData(data){
	var arr=[];
	for(var i=0;i<data.length;i++){
		arr.push(data[i].name)
	}
	return arr
}

//折线图
var dataX=['2013','2014','2015','2016','2017','2018']
var data1=[13,12,12,12,11,11,8,8,6,4]
var data2=[25,7,2,3,9,3,1,2,2,2]
var data3=[15,17,2,13,19,31,11,12,2,2]
var data4=[52,27,22,3,29,23,21,22,22,22]
var lineOption = {
		color:["#ff9100","#4fe3de","#a1f379","#e5004f"],
		textStyle:{},
    tooltip: {
        trigger: 'axis',
        textStyle :{}
//      axisPointer: {
//          type: 'cross',
//          crossStyle: {
//              color: '#999'
//          }
//      }
    },
    toolbox: {
    	show:false,
        feature: {
            dataView: {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar']},
            restore: {show: true},
            saveAsImage: {show: true}
        }
    },
    legend: {
    	show:true,
    	top:10,
    	textStyle:{
    		color:'#fff'
    	},
      data:['IDC','CDN','云','总数']
    },
    grid: {
    	left:'2%',
      top: 45,
      right:10,
      bottom: '2%',
      containLabel:true
    },
    xAxis: [
        {
          type: 'category',
          data: dataX,
          boundaryGap : false,
          axisPointer: {
//            type: 'none'
          },
          axisLabel:{
          	color:'#c0d4da',
        	rotate : 25,
          },
	        axisLine:{
	        	show:true,
	        	lineStyle:{
	        		color:'#c0d4da'
	        	}
	        }
        }
    ],
    yAxis: [
        {
          type: 'value',
          name: '单位',
          min: 0,
//        max: 250,
//        interval: 50,
          axisLabel: {
            color:'#c0d4da'
          },
          axisLine:{
	        	show:true,
	        	lineStyle:{
	        		color:'#c0d4da'
	        	}
        	},
        	splitLine:{
        		lineStyle:{
	        		color:'#272858'
	        	}
        	}
        }
    ],
    series: [
      {name:'IDC',
        type:'line',
        smooth:true,
        symbol: 'circle',
        data:[124,232,363,337,239,55]
      },{
        name:'CDN',
        type:'line',
        smooth:true,
        symbol: 'circle',
        data:[0,0,0,4,66,34]
      },{
        name:'云',
        type:'line',
        smooth:true,
        symbol: 'circle',
        data:[0,0,0,14,104,72]
      },{
        name:'总数',
        type:'line',
        smooth:true,
        symbol: 'circle',
        data:[124,232,362,355,409,161]
      }
    ]
};

var lineChart = echarts.init(document.getElementById('ecLine'))
lineChart.setOption(optionFontSize(lineOption))

//柱状图
var dataBar1=[13,12,12,12,11,11,8,8,6,4]
var dataBar2=[5,7,2,3,9,3,1,2,2,2]
var barOption = {
		color:["#c8fd6f","#08e2ca"],
		textStyle:{},
    tooltip: {
        trigger: 'axis',
        textStyle: {
        	
        }
//      axisPointer: {
//          type: 'cross',
//          crossStyle: {
//              color: '#999'
//          }
//      }
    },
    toolbox: {
    	show:false,
        feature: {
            dataView: {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar']},
            restore: {show: true},
            saveAsImage: {show: true}
        }
    },
    legend: {
    	show:true,
    	top:10,
    	textStyle:{
    		color:'#fff'
    	},
      data:['单一地区','跨地区']
    },
    grid: {
        left:'2%',
        top: 45,
        right:10,
        bottom: '2%',
        containLabel:true
    },
    xAxis: [
        {
          type: 'category',
          data: dataX,
          axisPointer: {
              type: 'shadow'
          },
          axisLabel:{
          	color:'#c0d4da',
          	rotate : 25,
          },
	        axisLine:{
	        	show:true,
	        	lineStyle:{
	        		color:'#c0d4da'
	        	}
	        }
        }
    ],
    yAxis: [
        {
          type: 'value',
          name: '单位',
          min: 0,
//        max: 250,
//        interval: 50,
          axisLabel: {
            color:'#c0d4da'
          },
          axisLine:{
	        	show:true,
	        	lineStyle:{
	        		color:'#c0d4da',
	        	}
        	},
        	splitLine:{
        		lineStyle:{
	        		color:'#272858'
	        	}
        	}
        }
    ],
    series: [
      {
        name:'单一地区',
        type:'bar',
        barWidth:'25%',
        data:[81,151,203,179,124,34]
      },{
        name:'跨地区',
        type:'bar',
        barWidth:'25%',
        data:[43,81,159,158,115,21]
      }
    ]
};

var barChart = echarts.init(document.getElementById('ecBar'))
barChart.setOption(optionFontSize(barOption))





//左上饼图
var pieData=[
    {value:1789, name:'IDC'},
    {value:173, name:'CDN'},
    {value:274, name:'云计算'}
  ]
var color1 = ["#ffe34e",  "#93dd6e", "#ff8700","#09e2cb"]
function allData(data) {
	var allNum = 0
	for(var a = 0; a < data.length; a++) {
		allNum += data[a].value
	}
	return allNum
}

var pie3Opt = {
	color: color1,
	textStyle: {},
	backgroundColor: 'transparent',
	tooltip: {
		trigger: 'item',
		//  formatter: "{a} <br/>{b} : {c} ({d}%)",
		textStyle: {},
		position: 'right',
		formatter: function(param) {
			if(param.name) {
				return '<div>' + param.name + '</div>' +
					'<div>' + param.value + '  (' + param.percent + '%)</div>'
			}
		}
	},
	legend: {
		orient: 'vertical',
		left: 10,
		textStyle: {
			color: 'rgba(255,255,255,0.8)'
		},
		show: true,
		data: legendData(pieData)
	},
	series: [{
		name: '',
		type: 'pie',
		radius: ['50%', '70%'],
		center: ['45%', '50%'],
		hoverAnimation: true,
		label: {
			normal: {
				show: false,
				position: 'center'
			},
			emphasis: {
				show: false,
				textStyle: {
					fontSize: '30',
					fontWeight: 'bold'
				}
			}
		},
		data: pieData
	}, {
		name: '',
		type: 'pie',
		clockWise: true,
		hoverAnimation: false,
		animationType: 'scale',
		radius: [200, 200],
		center: ['45%', '50%'],
		label: {
			normal: {
				position: 'center'
			}
		},
		data: [{
			value: 0,
			label: {
				normal: {
					formatter: '38',
					textStyle: {
						color: '#20fd07',
						fontSize: 25,
						fontWeight: 'bold'
					}
				}
			}
		}, {
			tooltip: {
				show: false
			},
			label: {
				normal: {
					formatter: '\n门户',
					textStyle: {
						color: '#bbeaf9',
						fontSize: 12
					}
				}
			}
		}]
	}]
};

var pie3Chart = echarts.init(document.getElementById('ec_pie_nd'))
pie3Chart.setOption(optionFontSize(pie3Opt))

var pieIndex = 0
var t

function pieAutoShow() {
	if(pieIndex > 3 - 1) {
		pieIndex = 0
	}
	for(var i = 0; i < 3; i++) {
		if(i != pieIndex) {
			pie3Opt.series[0].data[i]['selected'] = false;
		} else {
			pie3Opt.series[0].data[i]['selected'] = true;
		}
	}
	pie3Opt.series[1].data[0].label.normal.formatter = (pie3Opt.series[0].data[pieIndex].value / allData(pieData) * 100).toFixed(1) + "%"
	// pie3Opt.series[1].data[0].label.normal.formatter=parseInt(Math.random()*99) + "%"
	pie3Opt.series[1].data[1].label.normal.formatter = "" + pie3Opt.series[0].data[pieIndex].name
	pie3Chart.setOption(pie3Opt)
	pieIndex++
}
pieAutoShow()
t = window.setInterval(pieAutoShow, 1200)

//optionFontSize(barOption);
window.addEventListener('resize',function(){
	barChart.setOption(optionFontSize(barOption));
	lineChart.setOption(optionFontSize(lineOption))
	mapChart.setOption(optionFontSize(optionMap))
	myBarChart.setOption(optionFontSize(pieOptionLeftBottom))
	pie3Chart.setOption(optionFontSize(pie3Opt))
})

function optionFontSize(el){
	var winW=$(window).width();
	var fontSize=winW>3000?20:12
//	el.legend.textStyle.fontSize=fontSize
	if(el.xAxis){
		el.xAxis[0].axisLabel.fontSize=fontSize
		el.xAxis[0].axisLabel.rotate=0
		el.yAxis[0].axisLabel.fontSize=fontSize
	}
	el.textStyle.fontSize=fontSize
	el.tooltip.textStyle.fontSize=fontSize
	return el
}


window.addEventListener("resize", function () {
    mapChart.resize();
    barChart.resize();
    lineChart.resize();
    myBarChart.resize();
    pie3Chart.resize();
});












